#include<iostream>
#include<iomanip>
using namespace std;

int main() {
	enum doctor{A,B,C,D,E,F,G};//0 1 2 3 4 5 6
	doctor turn;
	int a, b, c, d, e, f,g;
	e = E;
	for (c = A; c <= G; c++)
		for (g = A; g <= G; g++)
			for (a = c + 1; a <= G; a++)
				for (b = g - 3; b <= G; b++)
					for (d = e + 2; d <= G; d++)
						for (f = A; f <= G; f++)

							if (a == c + 1 && d == e + 2 && b == g - 3 && ((f > b&&f < c) || (f<b&&f>c)) && (a != b) && (a != c) && (a != d) && (a != e) && (a != f) && (a != g) && (b != c) && (b != d) && (b != e) && (b != f) && (b != g) && (c != d) && (c != e) && (c != f) && (c != g) && (d != e) && (d != f) && (d != g) && (f != g))
							{
								if (b < 0 && f == 0)
								{
									b = b + 7;
									f = f + 7;
									cout << "Doctor A is on duty " << f << "\nDoctor B is on duty " << c << "\nDoctor C is on duty " << d << "\nDoctor D is on duty " << a << "\nDoctor F is on duty " << e << "\nDoctor E is on duty " << g << "\nDoctor G is on duty " << b << "\n";
								}
							}

						
}